﻿
Partial Class Pages_Admin_Forum
    Inherits System.Web.UI.Page
    Dim f As NewsDAO


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        'Listar alla icke publiserade inlägg
        If Not IsPostBack Then
            rptForumAdmin.DataSource = New ForumDAO().GetAllForumAdmin()
            rptForumAdmin.DataBind()
        End If
    End Sub



    'Protected Sub rptNewsStartingpageforum_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles rptNewsStartingpageforum.ItemCommand

    '    If e.Item.ItemType = ListItemType.Item Then
    '        For Each Item In rptNewsStartingpageforum.Items
    '        Next

    '        If (e.CommandArgument) Is "PublishClick" Then


    '            Dim s As New NewsDAO
    '            s.Confirm = "heeeeeeeeeeej"
    '            s.UpdateMessage(s)

    '            Response.Write("<script language='javascript'>alert('Nyhet Updaterad')</script>")
    '            Response.Redirect("start.aspx")
    '        End If
    '    End If
    'End Sub


    'Protected Sub rptNewsStartingpageforum_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptNewsStartingpageforum.ItemDataBound

    ''Hittar och databinder alla textboxarna

    'For Each item In rptNewsStartingpageforum.Items
    'Next
    'Dim headerTxt As TextBox = CType(e.Item.FindControl("txtEditHeader"), TextBox)
    'headerTxt.Text = DataBinder.Eval(e.Item.DataItem, "Header")
    ''text
    'Dim textTxt As TextBox = CType(e.Item.FindControl("txtEditText"), TextBox)
    'textTxt.Text = DataBinder.Eval(e.Item.DataItem, "Texten")

    'Dim BtnPublish As Button = CType(e.Item.FindControl("btnPublish"), Button)
    'Dim b As Boolean = CBool(DataBinder.Eval(e.Item.DataItem, "Confirm"))
    'BtnPublish.CommandArgument = b

    'Dim checkBoxPrio As CheckBox = CType(e.Item.FindControl("chkPublish"), CheckBox)
    'Dim b As Boolean = CBool(DataBinder.Eval(e.Item.DataItem, "Confirm"))
    'checkBoxPrio.Checked = b

    'Hittar knapparna som publiserar eller tar bort
    'Dim btnPublish As Button = CType(e.Item.FindControl("btnpublish"), Button)
    'btnPublish = DataBinder.Eval(e.Item.DataItem, "Button")

    'Dim btndelete As Button = CType(e.Item.FindControl("btndelete"), Button)
    'btndelete = DataBinder.Eval(e.Item.DataItem, "Button")

    'End Sub




    Protected Sub rptForumAdmin_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles rptForumAdmin.ItemCommand

        'If (!IsPostBack) Then
        '    Bind()

        'End If

        'If (e.CommandArgument) Is "UpdateClick" Then

        '    f.UpdateMessage(s)

        'c.NewsID = a
        'c.Header = b
        'c.Texten = d

        'Dim ab As New NewsDAO()
        'ab.EditNews(c)

        'End If
        'Dim s As New NewsDAO()

        'If e.CommandName = "PublishClick" Then

        '    f.UpdateMessage(s)
        '    Response.Write(e.CommandArgument)
        '    Response.Redirect("Admin/Forum.aspx")
        'End If

        '        if e.CommandName = "publish" Then MyMethod() End if typ
        'MyMethod(e.CommandArgument) för att skicka med argumenten som låg på knappen.

        

    End Sub
End Class
